
// expressions_test

pub fn expressions_test() {
    println!("带分号的是语句，似乎不返回值！ 不带分号的是表达式要返回值，但是带分号的也有表达式，单一功能");
    // variable binding
    let x = 5;

    // expression;
    println!("// expression");
    println!("x;");
    println!("x + 1; // 要报unused警告");
    println!("15;");
    println!("let x = 5u32;");
    x;
    x + 1;
    15;
    let x = 5u32;

    let y = {
        let x_squared = x * x;
        let x_cube = x_squared * x;

        // This expression will be assigned to `y`
        x_cube + x_squared + x
    };

    let z = {
        println!("The semicolon suppresses this expression and `()` is assigned to `z`。 下面这句（2 * x;）要报 unused 警告。但是好像实际上是用了。");
        2 * x;
    };

    println!("x is {:?}", x);
    println!("y is {:?}", y);
    println!("z is {:?}", z);
}
